﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using DBA.Data;
using DBA.Data.ADO;
using DBA.Model;

namespace Demo
{
    public partial class demo_page3Add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) return;
        }
        DataAccessLibrary dal = CommonQuery.DataAccessLibrary;


        protected void lbtn_Save_Click(object sender, EventArgs e)
        {
            Test_UserInfo userInfo = new Test_UserInfo();
            userInfo.UserName = txtUserName.Text.Trim();
            userInfo.Address = txtAddress.Text.Trim();
            userInfo.IDcard = txtIDCard.Text.Trim();
            userInfo.Phone = txtPhone.Text.Trim();
            userInfo.Mobile = txtMobile.Text.Trim();
            userInfo.Email = txtEmail.Text.Trim();
            userInfo.PostalCode = txtPostalCode.Text.Trim();

            int reValue = dal.ModifyData.Insert<Test_UserInfo>(userInfo);

            if (reValue > 0)
            {
                ScriptManager.RegisterStartupScript(this, base.GetType(), "insertOk" + System.Guid.NewGuid().ToString(), "Public.OpertAlert('数据添加成功',true);", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, base.GetType(), "insertError" + System.Guid.NewGuid().ToString(), "alert('数据添加失败!');", true);
            }

        }
    }
}